home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4907 < prev    next >
Mailbox/MIME Entity  |  1996-08-06  |  2.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 73 64 | 63 63 31 32 2e 75 63 73 |Path: sd|cc12.ucs|
|00000010| 64 2e 65 64 75 21 73 7a | 65 63 68 75 61 6e 21 6a |d.edu!sz|echuan!j|
|00000020| 73 74 72 6f 75 74 0a 46 | 72 6f 6d 3a 20 4a 6f 73 |strout.F|rom: Jos|
|00000030| 65 70 68 20 53 74 72 6f | 75 74 20 3c 6a 73 74 72 |eph Stro|ut <jstr|
|00000040| 6f 75 74 40 75 63 73 64 | 2e 65 64 75 3e 0a 4e 65 |out@ucsd|.edu>.Ne|
|00000050| 77 73 67 72 6f 75 70 73 | 3a 20 63 6f 6d 70 2e 6c |wsgroups|: comp.l|
|00000060| 61 6e 67 2e 63 2b 2b 0a | 53 75 62 6a 65 63 74 3a |ang.c++.|Subject:|
|00000070| 20 52 65 3a 20 72 61 6e | 64 6f 6d 20 6e 75 6d 62 | Re: ran|dom numb|
|00000080| 65 72 20 69 6e 20 43 2b | 2b 0a 44 61 74 65 3a 20 |er in C+|+.Date: |
|00000090| 54 68 75 2c 20 31 20 46 | 65 62 20 31 39 39 36 20 |Thu, 1 F|eb 1996 |
|000000a0| 30 38 3a 31 31 3a 34 37 | 20 2d 30 38 30 30 0a 4f |08:11:47| -0800.O|
|000000b0| 72 67 61 6e 69 7a 61 74 | 69 6f 6e 3a 20 55 6e 69 |rganizat|ion: Uni|
|000000c0| 76 65 72 73 69 74 79 20 | 6f 66 20 43 61 6c 69 66 |versity |of Calif|
|000000d0| 6f 72 6e 69 61 2c 20 53 | 61 6e 20 44 69 65 67 6f |ornia, S|an Diego|
|000000e0| 0a 4d 65 73 73 61 67 65 | 2d 49 44 3a 20 3c 50 69 |.Message|-ID: <Pi|
|000000f0| 6e 65 2e 53 55 4e 2e 33 | 2e 39 31 2e 39 36 30 32 |ne.SUN.3|.91.9602|
|00000100| 30 31 30 38 30 37 32 39 | 2e 31 34 38 32 37 46 2d |01080729|.14827F-|
|00000110| 31 30 30 30 30 30 40 73 | 7a 65 63 68 75 61 6e 3e |100000@s|zechuan>|
|00000120| 0a 52 65 66 65 72 65 6e | 63 65 73 3a 20 3c 34 65 |.Referen|ces: <4e|
|00000130| 6f 68 30 33 24 36 6a 62 | 40 70 61 63 65 6d 61 6b |oh03$6jb|@pacemak|
|00000140| 65 72 2e 63 74 73 3e 0a | 4e 4e 54 50 2d 50 6f 73 |er.cts>.|NNTP-Pos|
|00000150| 74 69 6e 67 2d 48 6f 73 | 74 3a 20 73 7a 65 63 68 |ting-Hos|t: szech|
|00000160| 75 61 6e 2e 75 63 73 64 | 2e 65 64 75 0a 4d 69 6d |uan.ucsd|.edu.Mim|
|00000170| 65 2d 56 65 72 73 69 6f | 6e 3a 20 31 2e 30 0a 43 |e-Versio|n: 1.0.C|
|00000180| 6f 6e 74 65 6e 74 2d 54 | 79 70 65 3a 20 54 45 58 |ontent-T|ype: TEX|
|00000190| 54 2f 50 4c 41 49 4e 3b | 20 63 68 61 72 73 65 74 |T/PLAIN;| charset|
|000001a0| 3d 55 53 2d 41 53 43 49 | 49 0a 58 2d 53 65 6e 64 |=US-ASCI|I.X-Send|
|000001b0| 65 72 3a 20 6a 73 74 72 | 6f 75 74 40 73 7a 65 63 |er: jstr|out@szec|
|000001c0| 68 75 61 6e 0a 49 6e 2d | 52 65 70 6c 79 2d 54 6f |huan.In-|Reply-To|
|000001d0| 3a 20 3c 34 65 6f 68 30 | 33 24 36 6a 62 40 70 61 |: <4eoh0|3$6jb@pa|
|000001e0| 63 65 6d 61 6b 65 72 2e | 63 74 73 3e 20 0a 0a 4f |cemaker.|cts> ..O|
|000001f0| 6e 20 33 31 20 4a 61 6e | 20 31 39 39 36 2c 20 42 |n 31 Jan| 1996, B|
|00000200| 72 69 61 6e 20 41 2e 20 | 42 75 63 68 65 72 20 77 |rian A. |Bucher w|
|00000210| 72 6f 74 65 3a 0a 0a 3e | 20 49 73 20 74 68 65 72 |rote:..>| Is ther|
|00000220| 65 20 5f 41 4e 59 5f 20 | 77 61 79 20 74 6f 20 67 |e _ANY_ |way to g|
|00000230| 65 74 20 61 20 74 72 75 | 6c 79 20 72 61 6e 64 6f |et a tru|ly rando|
|00000240| 6d 20 6e 75 6d 62 65 72 | 20 69 6e 20 61 20 43 2b |m number| in a C+|
|00000250| 2b 20 70 72 6f 67 72 61 | 6d 3f 0a 3e 20 72 61 6e |+ progra|m?.> ran|
|00000260| 64 20 61 6e 64 20 73 72 | 61 6e 64 20 64 6f 20 6e |d and sr|and do n|
|00000270| 6f 74 20 67 65 6e 65 72 | 61 74 65 20 72 61 6e 64 |ot gener|ate rand|
|00000280| 6f 6d 20 6e 75 6d 62 65 | 72 73 2c 20 74 68 65 79 |om numbe|rs, they|
|00000290| 20 67 65 6e 65 72 61 74 | 65 0a 3e 20 70 73 65 75 | generat|e.> pseu|
|000002a0| 64 6f 2d 72 61 6e 64 6f | 6d 20 6e 75 6d 62 65 72 |do-rando|m number|
|000002b0| 73 2c 20 77 68 69 63 68 | 20 69 73 20 77 68 61 74 |s, which| is what|
|000002c0| 20 49 20 64 6f 6e 27 74 | 20 6e 65 65 64 2e 0a 0a | I don't| need...|
|000002d0| 54 68 65 72 65 20 69 73 | 20 4e 4f 20 77 61 79 20 |There is| NO way |
|000002e0| 74 6f 20 67 65 74 20 61 | 20 74 72 75 6c 79 20 72 |to get a| truly r|
|000002f0| 61 6e 64 6f 6d 20 6e 75 | 6d 62 65 72 20 69 6e 20 |andom nu|mber in |
|00000300| 61 6e 79 20 73 6f 66 74 | 77 61 72 65 2e 20 20 43 |any soft|ware. C|
|00000310| 6f 6d 70 75 74 65 72 73 | 20 0a 74 6f 64 61 79 20 |omputers| .today |
|00000320| 61 72 65 20 64 65 74 65 | 72 6d 69 6e 69 73 74 69 |are dete|rministi|
|00000330| 63 2c 20 61 6e 64 20 67 | 69 76 65 6e 20 74 68 65 |c, and g|iven the|
|00000340| 20 73 61 6d 65 20 73 74 | 61 72 74 69 6e 67 20 63 | same st|arting c|
|00000350| 6f 6e 64 69 74 69 6f 6e | 73 2c 20 61 6e 79 20 0a |ondition|s, any .|
|00000360| 70 61 72 74 69 63 75 6c | 61 72 20 61 6c 67 6f 72 |particul|ar algor|
|00000370| 69 74 68 6d 20 77 69 6c | 6c 20 67 69 76 65 20 79 |ithm wil|l give y|
|00000380| 6f 75 20 74 68 65 20 73 | 61 6d 65 20 72 65 73 75 |ou the s|ame resu|
|00000390| 6c 74 20 61 67 61 69 6e | 20 61 6e 64 20 61 67 61 |lt again| and aga|
|000003a0| 69 6e 2e 0a 0a 49 6e 20 | 70 72 69 6e 63 69 70 6c |in...In |principl|
|000003b0| 65 2c 20 6f 6e 65 20 63 | 6f 75 6c 64 20 62 75 69 |e, one c|ould bui|
|000003c0| 6c 64 20 61 20 72 61 6e | 64 6f 6d 20 6e 75 6d 62 |ld a ran|dom numb|
|000003d0| 65 72 20 63 68 69 70 20 | 77 68 69 63 68 20 73 65 |er chip |which se|
|000003e0| 65 64 65 64 20 69 74 73 | 65 6c 66 20 0a 76 69 61 |eded its|elf .via|
|000003f0| 20 71 75 61 6e 74 75 6d | 20 66 6c 75 63 74 75 61 | quantum| fluctua|
|00000400| 74 69 6f 6e 73 2c 20 65 | 6e 76 69 72 6f 6e 6d 65 |tions, e|nvironme|
|00000410| 6e 74 61 6c 20 6e 6f 69 | 73 65 2c 20 65 74 63 2e |ntal noi|se, etc.|
|00000420| 2c 20 62 75 74 20 61 73 | 20 66 61 72 20 61 73 20 |, but as| far as |
|00000430| 49 20 6b 6e 6f 77 20 0a | 6e 6f 62 6f 64 79 20 68 |I know .|nobody h|
|00000440| 61 73 20 64 6f 6e 65 20 | 74 68 69 73 2e 0a 0a 53 |as done |this...S|
|00000450| 6f 20 74 68 65 20 62 65 | 73 74 20 79 6f 75 20 63 |o the be|st you c|
|00000460| 61 6e 20 64 6f 20 69 6e | 20 73 6f 66 74 77 61 72 |an do in| softwar|
|00000470| 65 20 69 73 20 66 69 6e | 64 20 61 20 67 6f 6f 64 |e is fin|d a good|
|00000480| 20 70 73 65 75 64 6f 72 | 61 6e 64 6f 6d 20 6e 75 | pseudor|andom nu|
|00000490| 6d 62 65 72 20 0a 67 65 | 6e 65 72 61 74 6f 72 2e |mber .ge|nerator.|
|000004a0| 20 20 72 61 6e 64 28 29 | 20 69 73 6e 27 74 20 6f | rand()| isn't o|
|000004b0| 6e 65 20 2d 2d 20 49 20 | 72 65 6d 65 6d 62 65 72 |ne -- I |remember|
|000004c0| 20 6f 6e 63 65 20 49 20 | 77 61 73 20 67 65 6e 65 | once I |was gene|
|000004d0| 72 61 74 69 6e 67 20 72 | 61 6e 64 6f 6d 20 0a 54 |rating r|andom .T|
|000004e0| 75 72 69 6e 67 20 6d 61 | 63 68 69 6e 65 73 2c 20 |uring ma|chines, |
|000004f0| 75 73 69 6e 67 20 6f 6e | 6c 79 20 74 68 65 20 6c |using on|ly the l|
|00000500| 61 73 74 20 62 69 74 20 | 72 65 74 75 72 6e 65 64 |ast bit |returned|
|00000510| 20 66 72 6f 6d 20 72 61 | 6e 64 28 29 20 63 61 6c | from ra|nd() cal|
|00000520| 6c 73 2c 20 61 6e 64 20 | 0a 74 68 65 79 20 63 61 |ls, and |.they ca|
|00000530| 6d 65 20 6f 75 74 20 30 | 31 30 31 30 31 30 31 30 |me out 0|10101010|
|00000540| 31 30 31 2e 2e 2e 2e 0a | 0a 72 61 6e 64 6f 6d 28 |101.....|.random(|
|00000550| 29 20 69 6e 20 74 68 65 | 20 67 2b 2b 20 3c 6d 61 |) in the| g++ <ma|
|00000560| 74 68 2e 68 3e 20 6c 69 | 62 72 61 72 79 20 69 73 |th.h> li|brary is|
|00000570| 20 62 65 74 74 65 72 2c | 20 62 75 74 20 74 68 69 | better,| but thi|
|00000580| 73 20 69 73 6e 27 74 20 | 61 76 61 69 6c 61 62 6c |s isn't |availabl|
|00000590| 65 20 0a 6f 6e 20 61 6c | 6c 20 70 6c 61 74 66 6f |e .on al|l platfo|
|000005a0| 72 6d 73 2e 20 20 49 20 | 74 68 69 6e 6b 20 22 4e |rms. I |think "N|
|000005b0| 75 6d 65 72 69 63 61 6c | 20 52 65 63 69 70 65 73 |umerical| Recipes|
|000005c0| 20 69 6e 20 43 22 20 64 | 69 73 63 75 73 73 65 73 | in C" d|iscusses|
|000005d0| 20 0a 70 73 65 75 64 6f | 72 61 6e 64 6f 6d 20 6e | .pseudo|random n|
|000005e0| 75 6d 62 65 72 20 67 65 | 6e 65 72 61 74 6f 72 73 |umber ge|nerators|
|000005f0| 2c 20 73 6f 20 79 6f 75 | 20 63 6f 75 6c 64 20 63 |, so you| could c|
|00000600| 6f 64 65 20 79 6f 75 72 | 20 6f 77 6e 20 69 66 20 |ode your| own if |
|00000610| 6e 65 65 64 65 64 2e 0a | 0a 57 68 61 74 20 6d 6f |needed..|.What mo|
|00000620| 73 74 20 70 65 6f 70 6c | 65 20 64 6f 20 69 73 20 |st peopl|e do is |
|00000630| 6a 75 73 74 20 73 65 65 | 64 20 74 68 65 20 72 61 |just see|d the ra|
|00000640| 6e 64 6f 6d 20 6e 75 6d | 62 65 72 20 67 65 6e 65 |ndom num|ber gene|
|00000650| 72 61 74 6f 72 20 77 69 | 74 68 20 73 6f 6d 65 20 |rator wi|th some |
|00000660| 0a 6d 6f 73 74 6c 79 2d | 75 6e 70 72 65 64 69 63 |.mostly-|unpredic|
|00000670| 74 61 62 6c 65 20 76 61 | 6c 75 65 2c 20 73 75 63 |table va|lue, suc|
|00000680| 68 20 61 73 20 74 68 65 | 20 73 79 73 74 65 6d 20 |h as the| system |
|00000690| 74 69 6d 65 20 6f 72 20 | 74 68 65 20 6e 75 6d 62 |time or |the numb|
|000006a0| 65 72 20 6f 66 20 0a 63 | 79 63 6c 65 73 20 69 74 |er of .c|ycles it|
|000006b0| 20 74 61 6b 65 73 20 74 | 68 65 20 75 73 65 72 20 | takes t|he user |
|000006c0| 74 6f 20 70 72 65 73 73 | 20 61 20 6b 65 79 2e 0a |to press| a key..|
|000006d0| 0a 2c 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.,------|--------|
|000006e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000700| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000710| 2d 2d 2d 2d 2e 0a 7c 20 | 20 20 20 4a 6f 73 65 70 |----..| | Josep|
|00000720| 68 20 4a 2e 20 53 74 72 | 6f 75 74 20 20 20 20 20 |h J. Str|out |
|00000730| 20 20 20 20 20 20 44 65 | 70 61 72 74 6d 65 6e 74 | De|partment|
|00000740| 20 6f 66 20 4e 65 75 72 | 6f 73 63 69 65 6e 63 65 | of Neur|oscience|
|00000750| 2c 20 55 43 53 44 20 20 | 20 7c 0a 7c 20 20 20 20 |, UCSD | |.| |
|00000760| 6a 73 74 72 6f 75 74 40 | 75 63 73 64 2e 65 64 75 |jstrout@|ucsd.edu|
|00000770| 20 20 20 20 20 20 20 20 | 20 20 20 68 74 74 70 3a | | http:|
|00000780| 2f 2f 77 77 77 2d 61 63 | 73 2e 75 63 73 64 2e 65 |//www-ac|s.ucsd.e|
|00000790| 64 75 2f 7e 6a 73 74 72 | 6f 75 74 2f 20 20 7c 0a |du/~jstr|out/ |.|
|000007a0| 60 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |`-------|--------|
|000007b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007e0| 2d 2d 2d 27 0a 0a | |---'.. | |
+--------+-------------------------+-------------------------+--------+--------+